<%- include('css') %>
<div id="app" style="width:980px">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>新闻详情</legend>
    </fieldset>

    <div class="layui-container">
        <div class="layui-row">
            <div class="layui-col-md12" style="text-align: center">
                <span style="font-size: 36px;font-weight: bold" v-text="title"></span>
            </div>
            <div class="layui-col-md12" >
                <label>点击量：</label><span v-text="news.hits"></span>
            </div>
            <div class="layui-col-md12" >
                <label>来源：</label><span v-text="news.source"></span>
            </div>
            <div class="layui-col-md12" >
                <span v-text="news.created_at"></span>
            </div>
            <hr class="layui-bg-black">
            <div class="layui-col-md12" v-html="content">
            </div>
        </div>
    </div>
</div>

<%- include('script') %>

<script>

    var vm = new Vue({
        el: '#app',
        data:function(){
            
            return {
                id:'',
                isButtonDisabled:false,
                title:"",
                content:'',
                news:''
            }

        },
        mounted:function(){
            
            var self = this;

            self.id = '<%=id%>';
            $.get(
                '/admin/news/find?id=<%=id%>',
                function(rs){
                    if (rs.data.pic != null && rs.data.pic != "") {
                        self.pic =  rs.data.pic
                        self.haspic = true
                    }
                    self.title = rs.data.title;
                    self.content = rs.data.content;
                    self.news = rs.data;
                }
            )
        
        },
        
        methods:{

            doclose:function(){
                parent.vm.iframeclose();
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引         
                parent.layer.close(index); //再执行关闭
            }

        }
    })



    
</script>